//package com.jason.exception;
//
//import com.jason.utlis.JsonData;
//import org.slf4j.LoggerFactory;
//import org.springframework.web.bind.annotation.ControllerAdvice;
//import org.springframework.web.bind.annotation.ExceptionHandler;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import java.util.logging.Logger;
//
///**
// * 异常处理类
// */
//@ControllerAdvice
//public class CustomExceptionHandler {
//
//    private final static Logger logger= (Logger) LoggerFactory.getLogger(CustomExceptionHandler.class);
//
//    @ExceptionHandler(value = Exception.class)
//    @ResponseBody
//    public JsonData handle(Exception e){
////       logger.error("[ERROR]",e);
//        if (e instanceof XDException){
//            XDException xdException= (XDException) e;
//            return JsonData.bulidError(xdException.getCode(),xdException.getMsg());
//        }else {
//            return JsonData.bulidError("全局异常。未知错误！");
//        }
//    }
//
//}
